﻿using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using psieve.sieve;

namespace psieveTest
{
    [TestClass]
    public class TestSieve
    {
        private const int Elements = 100000;

        private static readonly List<long> expected = new Eratosthenes().Sieve(Elements).ToList();

        [TestMethod]
        public void TestSundaram()
        {
            var s = new Sundaram().Sieve(Elements);
            Assert.IsTrue(expected.SequenceEqual(s));
        }

        [TestMethod]
        public void TestEratosthenes2()
        {
            var s = new Eratosthenes2().Sieve(Elements);
            Assert.IsTrue(expected.SequenceEqual(s));
        }

        [TestMethod]
        public void TestEratosthenes_F()
        {
            var s = Sieve.findPrimes(Elements);
            Assert.IsTrue(expected.SequenceEqual(s));
        }
    }
}
